<?php

/**
 * Contains "ControllerClient" mvc controller class
 *
 * LICENSE: MIT
 *
 * @author Peter Pippinger
 * @category PP
 * @package PP_Mvc
 * @copyright Copyright (c) 2013 Peter Pippinger
 * @license http://opensource.org/licenses/MIT
 * @version 1.1.0
 * @since Class exists since release 1.0.0
 */

/**
 * "ControllerClient" mvc controller class
 *
 * Provides controller handling for mvc template
 *
 * @author Peter Pippinger
 * @category PP
 * @package PP_Mvc
 * @copyright Copyright (c) 2013 Peter Pippinger
 * @license http://opensource.org/licenses/MIT
 * @version 1.1.0
 * @since Class exists since release 1.0.0
 */
class ControllerClient
{

	/**
	 * Model object.
	 *
	 * @var object
	 */
	private $model;

	/**
	 * Initializes the controller.
	 *
	 * @param ModelClient $model        	
	 */
	public function __construct(ModelClient $model)
	{
		$this->model = $model;
		
		// Execute controller action.
		if (isset($_GET["action"]) && method_exists($this, "mvc{$_GET['action']}"))
			$this->{"mvc{$_GET['action']}"}();
	}

	/**
	 * Template funtion modifies the model.
	 */
	public function mvcClick()
	{
		$this->model->text = "Click!";
	}
}
